package www.cskaoyan.com.service.impl;

import www.cskaoyan.com.bean.Academy;
import www.cskaoyan.com.dao.AcademyManagerDao;
import www.cskaoyan.com.service.AcademyManagerService;

import java.sql.SQLException;
import java.util.List;

/**
 * 处理逻辑的地方
 */
public class AcademyManagerServiceImpl implements AcademyManagerService {

    // 调用持久层
    AcademyManagerDao academyManagerDao;

    public AcademyManagerServiceImpl(){
        academyManagerDao = new AcademyManagerDao();
    }

    @Override
    public boolean create(Academy academy)  throws SQLException {
        String academyName = academy.getAcademyName();

        int  row = academyManagerDao.create(academyName);

        return true;
    }


    @Override
    public List<Academy> getAcademyList() throws SQLException {

        List<Academy> list = academyManagerDao.getAcademyList();

        return list;
    }

    @Override
    public void deleteAcademy(Academy academy) throws SQLException {

        academyManagerDao.deleteAcademy(academy.getId());

    }
}
